//
//  ViewController.m
//  DotAnimation
//
//  Created by ShiMac on 15/6/11.
//  Copyright (c) 2015年 guoyan. All rights reserved.
//

#import "ViewController.h"
#import "AnimationViewController.h"
#import "DoubleDotViewController.h"

#import "SpinnerViewController.h"
@interface ViewController ()<UITableViewDataSource,UITableViewDelegate>
{

    UITableView *tableView;
    NSArray     *titleAry;
}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    titleAry =@[@"TwoDot",@"DoubleDot",@"MiniSpinner"];
    
    
    
    tableView=[[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    tableView.delegate=self;
    tableView.dataSource=self;
    [self.view addSubview:tableView];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    return [titleAry count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    UITableViewCell * cell=[[UITableViewCell alloc] init];
    cell.textLabel.text=[titleAry objectAtIndex:indexPath.row];
    
    return cell;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    switch (indexPath.row) {
        case 0:
        {
        
            AnimationViewController *animation=[[AnimationViewController alloc]init];
            [self presentViewController:animation animated:YES completion:nil];
        
        
        }
            
            break;
            
        case 1:
        {
        
            DoubleDotViewController *doubleView=[[DoubleDotViewController alloc]init];
            [self presentViewController:doubleView animated:YES completion:nil];
        
        
        }
            break;
        case 2:
        {
            SpinnerViewController *spinner=[[SpinnerViewController alloc]init];
            [self presentViewController:spinner animated:YES completion:nil];
            
        }
            break;
        default:
            break;
    }
    
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
